package com.cug.nageoffer.common.config;

import com.cug.nageoffer.common.interceptor.UserLoginInterceptor;
import com.github.pagehelper.PageInterceptor;
import org.apache.ibatis.plugin.Interceptor;
import org.redisson.api.RBloomFilter;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class UserWebMvcConfiguration implements WebMvcConfigurer {

    @Autowired
    private UserLoginInterceptor enterpriseUserLoginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(enterpriseUserLoginInterceptor)
                .excludePathPatterns("/api/**/**/login/**"
                        ,"/api/**/**/register/**"
                        ,"/api/index/**")
                .addPathPatterns("/api/**")
                ;
    }

    @Bean
    public Interceptor[] plugins() {
        return new Interceptor[]{new PageInterceptor()};
    }


}
